import {fetch} from '@/utils/fetch'
import {answer, user} from '../fragment'

export const create = async ({ progressId, data = null }) => {
  let res = await fetch({
    query: `mutation ($data: JSON) {
      createAnswer (input: {
        progressId: "${progressId}",
        data: $data
      }) {
        ${answer}
        user {
          ${user}
        }
      }
    }`,
    variables: {
      data
    },
    cache: false
  })
  return res.data.createAnswer
}
